:root {
    --parchment: #f4e9d8;
    --parchment-dark: #d4c4a8;
    --ink: #2c2416;
    --gold: #c9a961;
    --gold-dark: #9d7d3a;
    --burgundy: #6b2737;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background-color: var(--parchment);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.7;
}

.parchment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(44, 36, 22, 0.015) 2px,
            rgba(44, 36, 22, 0.015) 4px
        );
    pointer-events: none;
    z-index: 1;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--gold);
    color: var(--burgundy);
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.back-button:hover {
    background: var(--gold);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.4);
}

.header {
    text-align: center;
    padding: 80px 20px 40px;
    position: relative;
    z-index: 2;
    border-bottom: 2px solid var(--gold);
    background: linear-gradient(to bottom, var(--parchment) 0%, rgba(201, 169, 97, 0.05) 100%);
}

.ornament {
    font-size: 2.5rem;
    color: var(--gold);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

.ornament-left {
    left: 20px;
}

.ornament-right {
    right: 20px;
}

.title-container {
    max-width: 900px;
    margin: 0 auto;
}

.main-title {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 3.5rem;
    color: var(--burgundy);
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px rgba(201, 169, 97, 0.3);
}

.subtitle {
    font-family: 'Crimson Text', serif;
    font-size: 1.3rem;
    color: var(--gold-dark);
    font-style: italic;
    letter-spacing: 2px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    position: relative;
    z-index: 2;
}

.search-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.6);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--gold);
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    border: 2px solid var(--gold-dark);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--burgundy);
    box-shadow: 0 0 0 3px rgba(107, 39, 55, 0.1);
}

.clear-btn {
    padding: 15px 20px;
    background: var(--burgundy);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.clear-btn:hover {
    background: #8b3547;
    transform: scale(1.05);
}

.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(44, 36, 22, 0.15);
}

.talents-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Crimson Text', serif;
}

.talents-table thead {
    background: linear-gradient(135deg, var(--burgundy), #8b3547);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.talents-table th {
    padding: 18px 15px;
    text-align: left;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.talents-table th:last-child {
    border-right: none;
}

.talents-table tbody tr {
    border-bottom: 1px solid #e0d5c0;
    transition: all 0.2s ease;
}

.talents-table tbody tr:hover {
    background: rgba(201, 169, 97, 0.1);
    transform: scale(1.001);
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.1);
}

.talents-table tbody tr:nth-child(even) {
    background: rgba(244, 233, 216, 0.3);
}

.talents-table tbody tr:nth-child(even):hover {
    background: rgba(201, 169, 97, 0.15);
}

.talents-table tbody tr.hidden {
    display: none;
}

.talents-table td {
    padding: 15px;
    vertical-align: top;
    font-size: 0.95rem;
    line-height: 1.6;
}

.col-nom {
    width: 20%;
    min-width: 200px;
}

.col-effet {
    width: 45%;
    min-width: 400px;
}

.col-categorie {
    width: 20%;
    min-width: 180px;
}

.col-cout {
    width: 15%;
    min-width: 120px;
    text-align: center;
}

.talent-nom {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--burgundy);
    font-size: 1.05rem;
}

.talent-effet {
    color: var(--ink);
    line-height: 1.7;
}

.talent-competence {
    display: block;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(201, 169, 97, 0.15);
    border-left: 3px solid var(--gold);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gold-dark);
}

.talent-categorie {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    font-family: 'Cinzel', serif;
}

.cat-metier {
    background: rgba(139, 69, 19, 0.15);
    color: #8b4513;
    border: 1px solid #8b4513;
}

.cat-combat {
    background: rgba(180, 50, 50, 0.15);
    color: #b43232;
    border: 1px solid #b43232;
}

.cat-magie {
    background: rgba(130, 50, 180, 0.15);
    color: #8232b4;
    border: 1px solid #8232b4;
}

.cat-commun {
    background: rgba(50, 100, 180, 0.15);
    color: #3264b4;
    border: 1px solid #3264b4;
}

.cat-speciaux {
    background: rgba(218, 165, 32, 0.15);
    color: #daa520;
    border: 1px solid #daa520;
}

.talent-cout {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--burgundy);
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    border: 2px dashed var(--gold);
    margin-top: 20px;
}

.no-results p {
    font-size: 1.5rem;
    color: var(--burgundy);
    margin-bottom: 10px;
}

.no-results-hint {
    font-size: 1.1rem;
    color: var(--gold-dark);
    font-style: italic;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    display: inline-block;
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.sortable.sorted-asc .sort-icon {
    opacity: 1;
}

.sortable.sorted-asc .sort-icon::before {
    content: '▲';
}

.sortable.sorted-desc .sort-icon {
    opacity: 1;
}

.sortable.sorted-desc .sort-icon::before {
    content: '▼';
}

.highlight {
    background-color: #ffeb3b;
    color: #000;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
}

.footer {
    text-align: center;
    padding: 40px 20px 30px;
    position: relative;
    z-index: 2;
}

.divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 0 auto 20px;
}

.footer p {
    font-size: 0.95rem;
    color: var(--gold-dark);
    letter-spacing: 1px;
}

/* Filtres de catégories */
.category-filters {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--gold);
}

.filter-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--burgundy);
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: 1px;
}

.category-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.category-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.category-checkbox:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(44, 36, 22, 0.1);
}

.category-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--gold-dark);
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
    background: white;
}

.category-checkbox input[type="checkbox"]:checked ~ .checkbox-custom {
    background: var(--burgundy);
    border-color: var(--burgundy);
}

.category-checkbox input[type="checkbox"]:checked ~ .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.checkbox-label {
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 15px;
}

.checkbox-label.cat-metier {
    background: rgba(139, 69, 19, 0.15);
    color: #8b4513;
}

.checkbox-label.cat-combat {
    background: rgba(180, 50, 50, 0.15);
    color: #b43232;
}

.checkbox-label.cat-magie {
    background: rgba(130, 50, 180, 0.15);
    color: #8232b4;
}

.checkbox-label.cat-commun {
    background: rgba(50, 100, 180, 0.15);
    color: #3264b4;
}

.checkbox-label.cat-speciaux {
    background: rgba(218, 165, 32, 0.15);
    color: #daa520;
}

.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.filter-btn:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(157, 125, 58, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SYSTÈME DE SÉLECTION
   ═══════════════════════════════════════════════════════════════════════════ */

/* Barre d'info avec compteur et toggle */
.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--gold);
}

.results-count {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--burgundy);
    font-weight: 600;
}

.results-count span {
    color: var(--gold-dark);
    font-weight: 700;
}

/* Toggle Mode Sélection */
.selection-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-label {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--burgundy);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 30px;
    border: 2px solid var(--gold-dark);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--burgundy);
    border-color: var(--burgundy);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.toggle-slider:hover {
    box-shadow: 0 0 8px rgba(107, 39, 55, 0.3);
}

/* Lignes cliquables en mode sélection */
.talents-table tbody tr.selectable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.talents-table tbody tr.selectable:hover {
    background: rgba(201, 169, 97, 0.2) !important;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(44, 36, 22, 0.15);
}

.talents-table tbody tr.selected {
    background: rgba(201, 169, 97, 0.35) !important;
    border-left: 4px solid var(--gold);
}

.talents-table tbody tr.selected:hover {
    background: rgba(201, 169, 97, 0.45) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ZONE RÉCAPITULATIVE (TALENTS SÉLECTIONNÉS) - POSITIONNÉE AVANT LE TABLEAU
   ═══════════════════════════════════════════════════════════════════════════ */

.recap-section {
    margin-top: 30px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid var(--gold);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(44, 36, 22, 0.2);
}

.recap-header {
    text-align: center;
    position: relative;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gold);
}

.recap-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--burgundy);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.recap-counter {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: rgba(201, 169, 97, 0.15);
    border-radius: 10px;
    border: 2px solid var(--gold);
}

.recap-label {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--burgundy);
    font-weight: 600;
}

.recap-points {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--gold-dark);
    margin: 0 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.recap-label-pts {
    font-family: 'Crimson Text', serif;
    font-size: 1.2rem;
    color: var(--burgundy);
    font-style: italic;
}

.recap-table-wrapper {
    margin: 25px 0;
    overflow-x: auto;
}

.recap-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.recap-table thead {
    background: linear-gradient(135deg, var(--burgundy), #8b3547);
    color: white;
}

.recap-table th {
    padding: 15px;
    text-align: left;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.recap-table tbody tr {
    border-bottom: 1px solid #e0d5c0;
    transition: background 0.2s ease;
}

.recap-table tbody tr:hover {
    background: rgba(201, 169, 97, 0.1);
}

.recap-table td {
    padding: 12px 15px;
    font-family: 'Crimson Text', serif;
    font-size: 0.95rem;
    vertical-align: middle;
}

.recap-col-nom {
    width: 25%;
    font-weight: 600;
    color: var(--burgundy);
}

.recap-col-desc {
    width: 50%;
}

.recap-col-cout {
    width: 15%;
    text-align: center;
}

.recap-col-actions {
    width: 10%;
    text-align: center;
}

.recap-cout {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--burgundy);
}

.center {
    text-align: center;
}

/* Bouton suppression (poubelle) */
.delete-btn {
    background: rgba(180, 50, 50, 0.8);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: rgba(180, 50, 50, 1);
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(180, 50, 50, 0.4);
}

/* Message si liste vide */
.empty-recap {
    text-align: center;
    padding: 40px 20px;
    background: rgba(201, 169, 97, 0.05);
    border-radius: 8px;
    border: 2px dashed var(--gold);
}

.empty-recap p {
    font-size: 1.3rem;
    color: var(--burgundy);
    margin-bottom: 8px;
}

.empty-recap-hint {
    font-size: 1rem;
    color: var(--gold-dark);
    font-style: italic;
}

/* Actions de la zone récap */
.recap-actions {
    text-align: center;
    margin-top: 25px;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: var(--burgundy);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #8b3547;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(107, 39, 55, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .container {
        padding: 30px 15px 60px;
    }

    .talents-table th,
    .talents-table td {
        padding: 12px 10px;
        font-size: 0.9rem;
    }

    .talent-nom {
        font-size: 1rem;
    }
    
    .info-bar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .selection-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .back-button {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .header {
        padding: 70px 15px 30px;
    }

    .main-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .ornament {
        font-size: 1.8rem;
    }

    .search-section {
        padding: 20px 15px;
    }

    .search-bar {
        flex-direction: column;
    }

    #searchInput {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .clear-btn {
        padding: 12px;
    }

    .talents-table thead {
        display: none;
    }

    .talents-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 2px solid var(--gold);
        border-radius: 8px;
        padding: 15px;
        background: white;
    }

    .talents-table td {
        display: block;
        padding: 8px 0;
        border: none;
    }

    .talents-table td::before {
        content: attr(data-label);
        font-family: 'Cinzel', serif;
        font-weight: 700;
        color: var(--burgundy);
        display: block;
        margin-bottom: 5px;
    }

    .talent-cout {
        text-align: left;
    }

    .category-checkboxes {
        flex-direction: column;
    }
    
    .category-checkbox {
        width: 100%;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .info-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .recap-section {
        padding: 20px 15px;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    
    .recap-title {
        font-size: 1.5rem;
    }
    
    .recap-points {
        font-size: 2rem;
    }
    
    .recap-table thead {
        display: none;
    }
    
    .recap-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 2px solid var(--gold-dark);
        border-radius: 8px;
        padding: 12px;
    }
    
    .recap-table td {
        display: block;
        padding: 6px 0;
        border: none;
    }
    
    .recap-table td::before {
        content: attr(data-label);
        font-family: 'Cinzel', serif;
        font-weight: 700;
        color: var(--burgundy);
        display: block;
        margin-bottom: 5px;
    }
}